var color = new function() {
  this.average = function(c1, c2) {
    var r = Math.round(0.5 * (parseInt(c1.substring(1, 3), 16) + parseInt(c2.substring(1, 3), 16)));
    var g = Math.round(0.5 * (parseInt(c1.substring(3, 5), 16) + parseInt(c2.substring(3, 5), 16)));
    var b = Math.round(0.5 * (parseInt(c1.substring(5, 7), 16) + parseInt(c2.substring(5, 7), 16)));
    return "#" + r.toString(16) + g.toString(16) + b.toString(16);
  }
}